<template>
	<page>
		<view class='fixed-top-cont'>
			<view class="cont-block">
				<block v-for="(item,index) in itemList" wx:key="item" wx:for-index="index">
					<view class="cont-list" :class="currentTab == index ? 'listActive' : ''" :data-id="index" @tap="tab">
						<view class="newstabBar" :class="currentTab==index?'listActiveWhite':'listActiveWhite'">
							<text v-if="item.index<3">同城</text>
							<text v-if="item.index==3">附近</text>
							<text>{{item.name}}</text>
						</view> 
					</view>
				</block>
			</view>
			<!-- 分类筛选 -->
			<view class='fixed-top-container' v-if="currentTab == 0">
				<form report-submit='true' @submit='onSubmit'>
					<view class='fixed-top'>
						<view class='fixed-top-left dp-flex-y-center'>
							<button class='fixed-cat fixed-item dp-flex-y-center' form-type='submit' @tap='onWorkerType'>
								{{workerName ? workerName : "筛选工种"}}
							</button>
							<button class='fixed-birthPlace fixed-item dp-flex-y-center' form-type='submit' @tap='onBirthPlaceType'>
								{{birthPlaceName ? birthPlaceName : "筛选籍贯"}}
							</button>
							<view class='' @tap='handleRefreshTap'>
								<button class='fixed-birthPlace fixed-item dp-flex-y-center' form-type='submit'>
									全选
								</button>
							</view>
						</view>
					
					<!-- 	<view class='center_bar' @tap='sendXiaoxi' v-if="xinxiRes">
							<image src='/static/huanxin/images/voicemsg.png'></image>
						</view>
						 -->
						
						<view class='fixed-top-right'>
							<view>
								<button class='fixed-birthPlace fixed-item refresh-wrap dp-flex-xy-center' form-type='submit' open-type='contact' @tap='phonekf'>
									<image src='/static/images/index/wx.png' class='refresh-icon' mode='widthFix'></image>
								</button>
							</view>
						</view>
					</view>
				</form>
			</view>

		</view>


		<map :longitude="currLocation.longitude" :latitude="currLocation.latitude" id='map' class='map' scale="18" :markers="markers"
		 @markertap="markertap" @regionchange="onRegionChange" show-location :style="'height:'+system_height">
		 <!-- #ifdef MP-WEIXIN -->
		 <cover-view class="fixed-bottom-content " :class="showWorkerBox" :id="workerDetail.id" :data-status="workerDetail.status"
		  @tap="workerDetailTap">
		 	<cover-view class='worker-detail-box'>
		 		<cover-view class='photo-box dp-flex-y-center'>
		 			<cover-image class='photo' v-if="workerDetail.newAvatarUrl||workerDetail.avatarUrl" :src="workerDetail.newAvatarUrl||workerDetail.avatarUrl"></cover-image>
		 		</cover-view>
		 		<cover-view class='info-box dp-flex-col dp-flex-between'>
		 			<cover-view class='over-hidden ellipsis'>
		 				<cover-view class='float-l info-box-name'>{{workerDetail.name}}</cover-view>
		 				<cover-view class='worker-type float-l'>{{workerDetail.workCategory.name}}</cover-view>
		 			</cover-view>
		 			<cover-view class='txt-gray dp-flex-y-center'>
		 				<cover-view>距离您:</cover-view>
		 				<cover-view>{{distance}}</cover-view>
		 				<cover-view>公里</cover-view>
		 			</cover-view>
		 		</cover-view>
		 		<cover-view class='right-box'>
		 			<cover-view class='right-box-check' style='font-size:26upx;color:yellow;'>查看详情</cover-view>
		 			<cover-image class='right-box-check-img' src='/static/images/check-right.png'></cover-image>
		 		</cover-view>
		 	</cover-view>
		 </cover-view>
		  <!-- #endif -->
		</map>
		
		<!-- <view class='fixed-bottom-cont'>
				<cover-view class="fixed-bottom-content " :class="showWorkerBox" :id="workerDetail.id" :data-status="workerDetail.status"
				 @tap="workerDetailTap">
					<cover-view class='worker-detail-box'>
						<cover-view class='photo-box dp-flex-y-center'>
							<cover-image class='photo' v-if="workerDetail.newAvatarUrl||workerDetail.avatarUrl" :src="workerDetail.newAvatarUrl||workerDetail.avatarUrl"></cover-image>
						</cover-view>
						<cover-view class='info-box dp-flex-col dp-flex-between'>
							<cover-view class='over-hidden ellipsis'>
								<cover-view class='float-l info-box-name'>{{workerDetail.name}}</cover-view>
								<cover-view class='worker-type float-l'>{{workerDetail.workCategory.name}}</cover-view>
							</cover-view>
							<cover-view class='txt-gray dp-flex-y-center'>
								<cover-view>距离您:</cover-view>
								<cover-view>{{distance}}</cover-view>
								<cover-view>公里</cover-view>
							</cover-view>
						</cover-view>
						<cover-view class='right-box'>
							<cover-view class='right-box-check' style='font-size:26upx;color:yellow;'>查看详情</cover-view>
							<cover-image class='right-box-check-img' src='/static/images/check-right.png'></cover-image>
						</cover-view>
					</cover-view>
				</cover-view>
		</view>		
		 -->
		<!-- 显示底部图标 -->
		<!-- <cover-view class='map-banner' @tap="showUserModel">
		<cover-image src='https://gy-files.oss-cn-shenzhen.aliyuncs.com/picture/map-fujin.jpg' class='map-banner-img'></cover-image>
	</cover-view> -->
	
	
	
	
	</page>
</template>
<!-- 引入卫星地图 -->
<!-- <script src="https://webapi.amap.com/maps?v=1.4.15&key=80d8bd250371bf871f9b0ecc63650eb7"></script> -->
<script>
	import app from '@/App.vue';
	import {
		GYZJMODEL as gyzjModel
	} from '@/utils/gyzjModel.js'
	// import uniRate from '@/components/uni-rate/uni-rate.vue'
	export default {
		// components:{
		// 	uniRate  //第二步引入组件
		// },
		data() {
			return {
				itemList: [{
						name: '工友',
						index: 0
					},
					{
						name: '商家',
						index: 1
					},
					{
						name: '设计师',
						index: 2
					},
					{
						name: '工友',
						index: 3
					}
				],
				// 工种相关字段
				workerName: "",
				//籍贯相关字段
				birthPlaceName: "",
				district_id: "",
				filterWorkerData: [], // 筛选后工人的数据

				popGeneralize: false,
				isShowUserModal: false,
				isBanner: true,
				isPlaceShow: false,
				/*后追加的*/
				latitude: '',
				longitude: '',
				workerData: [], // 当前区域范围内工人的数据
				markers: [], //地图标注
				currLocation: {
					// longitude: "112.93886",
					// latitude: "28.22778"
					longitude: "132.93886",
					latitude: "28.22778"
				},
				//会员当前坐标
				showWorkerBox: 'hide',
				workerDetail: {}, //工人详情
				starArray: '', //获取星级评分
				currentTab: 0, //当前的条
				work_category_id: '', //工种id
				native_district_id: '', //户籍区县ID
				distance: "0",
				system_height: '10vh',
				icon_width:84,
				icon_height:84,
				xinxiRes:'true',
			}
		},
		onLoad() {
			/*进来获取设备宽高*/
			var that = this;
			uni.getSystemInfo({
				success: function(res) {
					// #ifdef MP-WEIXIN
					that.system_height = 2 * res.screenHeight + 'rpx';
					// #endif
					// #ifdef APP-PLUS
					that.system_height = 2 * res.screenHeight + 'upx';
					// #endif

				}
			});
			// this.getSelfPosition();
			
		},
		beforeCreate() {
			var that = this;
			// let globalData = app.globalData;
			uni.showLoading({
				title: '地图加载中....'
			})
			this.mapCtx = uni.createMapContext('map',this);
			console.log('mapCtx', this.mapCtx);
			console.log(uni.createMapContext('map',this));
 
			
			console.log('進來的創建a');
			// #ifdef APP-PLUS
			const subNVue = uni.getSubNVueById('layer');
			console.log('subNvue的值',subNVue);
			subNVue.hide();
			// #endif
			
			
			// this.getSelfPosition();
			// //定位
			console.log('定位执行方法前');
			uni.getLocation({
				type: 'gcj02',
				success: (res) => {
					console.log('地图resa', res); 
					console.log('地图res的经度' + res.latitude);
					console.log('地图res的纬度' + res.longitude);
					this.currLocation = res;
					this.mapCtx.moveToLocation();
					//将当前位置移动到地图中心
					//设置标记点
					console.log('得到值', this.currLocation);
					console.log('得到的经度', this.currLocation.latitude);
					console.log('得到的纬度', this.currLocation.longitude);
					let markers = {
						id: 66,
						name: '选择位置',
						iconPath: '../../static/loc.png',
						latitude: this.currLocation.latitude,
						longitude: this.currLocation.longitude,
						width: this.icon_width,
						height: this.icon_height,
						zIndex: 10,
					};

					// let mobile=app.globalData.mobile;
					// if(mobile){
					// 	this.isToken(this.currLocation.longitude, this.currLocation.latitude, 3,'','',mobile);
					// }else{
					// 	this.isToken(this.currLocation.longitude, this.currLocation.latitude, 3);
					// }
					let arr = that.main_getGlobal();
					if (arr.type == 2) {
						this.isToken(this.currLocation.longitude, this.currLocation.latitude, 3, '', '', arr.token);
					} else {
						this.isToken(this.currLocation.longitude, this.currLocation.latitude, 3);
					}
					//这行代码会出问题:本身无其他作用，页面不存在
					// this.loadCity(this.currLocation.longitude, this.currLocation.latitude);
					let markersData = this.markers;
					console.log('刚进来的markersData:', markersData);
					// markersData.unshift(markers);
					
					markersData.unshift(markers);
					this.markers = markersData;
				},
				fail: (error) => {
					console.log('定位失败',error);
					uni.hideLoading();
					if (error.errMsg.indexOf('auth') != -1) {

					}
				}
			})
			console.log('定位执行方法后');
		},
		methods: {
			getSelfPosition(){
				//定位
				// uni.authorize({
				// 	scope:'scope.userLocation', 
				// 	success(){
						console.log('定位成功uni.authorize');
						uni.getLocation({
							type: 'gcj02', 
							// wgs84
							success: (res) => {
								
								// uni.request({
								// 	url:"https://restapi.amap.com/v3/geocode/regeo?parameters",
								// 	method:'GET',
								// 	data:{
								// 		key:'80d8bd250371bf871f9b0ecc63650eb7',
								// 		location:res.longitude+','+res.latitude
								// 	}, 
								// 	success:(data)=> {
								// 		console.log('获取经纬度定位');
								// 		console.log(data.data)		// 注意就是data.data！！！
								// 	},
								// 	fail(err) {
								// 		console.log(err)
								// 	}
								// })
													
													
													
													
								console.log('地图resa', res);    
								// res.longitude=113.00736;
								// res.latitude=28.22749;
								console.log('地图res的经度' + res.latitude);
								console.log('地图res的纬度' + res.longitude);
								this.currLocation = res;
								this.mapCtx.moveToLocation();
								//将当前位置移动到地图中心
								//设置标记点
								console.log('得到值', this.currLocation);
								console.log('得到的经度', this.currLocation.latitude);
								console.log('得到的纬度', this.currLocation.longitude);
								let markers = {
									id: 66,
									name: '选择位置',
									iconPath: '../../static/loc.png',
									latitude: this.currLocation.latitude,
									longitude: this.currLocation.longitude,
									width: this.icon_width,
									height: this.icon_height,
									zIndex: 10,
								};
						
								// let mobile=app.globalData.mobile;
								// if(mobile){
								// 	this.isToken(this.currLocation.longitude, this.currLocation.latitude, 3,'','',mobile);
								// }else{
								// 	this.isToken(this.currLocation.longitude, this.currLocation.latitude, 3);
								// }
								let arr = that.main_getGlobal();
								if (arr.type == 2) {
									this.isToken(this.currLocation.longitude, this.currLocation.latitude, 3, '', '', arr.token);
								} else {
									this.isToken(this.currLocation.longitude, this.currLocation.latitude, 3);
								}
								//这行代码会出问题:本身无其他作用，页面不存在
								// this.loadCity(this.currLocation.longitude, this.currLocation.latitude);
								let markersData = this.markers;
								console.log('刚进来的markersData:', markersData);
								// markersData.unshift(markers);
								
								markersData.unshift(markers);
								this.markers = markersData;
							},
							fail: (error) => {
								uni.hideLoading();
								if (error.errMsg.indexOf('auth') != -1) {
						
								}
							}
						})
				// 	}
				// })
			},
			//拨打客服电话
			phonekf:function(){
				uni.makePhoneCall({
					phoneNumber: this.main_config_phone
				})
			},
			/*进行群拨打电话*/
			
			sendXiaoxi:function(){
				let mobileAttr=[],workerData=this.workerData,body;
				/*拿到用户信息显示雷达*/
				let userInfo=app.globalData.userInfo||'0739';
				var arr=[this.main_config_phone,'17775893773'];
				for(let i=0;i<workerData.length;i++){
					mobileAttr.push(workerData[i]['mobile']);
				}
				if(arr.indexOf(userInfo['mobile'])>=0){
					uni.showToast({
					  title: '正在查找中，请稍等...',
					  icon: 'loading'
					});
					console.log('查找到了');
					/*得到发送短信的文章内容*/
					// #ifdef APP-PLUS
					gyzjModel.prototype.getNewsDetail(23).then(data => {
						body = data.data.abstract;
						var msg = plus.messaging.createMessage(plus.messaging.TYPE_SMS);
							msg.to = mobileAttr;
							msg.body = body;
							plus.messaging.sendMessage(msg);
							uni.hideToast();
					});
					// #endif
				}
				
				
			},
		
			//标签切换
			  tab:function (e) {
			    let id = e.currentTarget.dataset.id,type = 0;
			    console.log(e);
			    console.log('a首页id'+id);
			    this.currentTab= id;
			    if(id==0){
			      type=3;
			    }else if(id==1){
			      type=4;
			    }else if(id==2){
			      type=5;
			    }else if(id==3){
			      uni.navigateTo({
			        url:'../../../../order-release-fujin/order-release-fujin?id=1'
			      })
			    }
				/*跳其他页也是首页*/
				// #ifdef APP-PLUS
				const subNVue = uni.getSubNVueById('layer');
				subNVue.hide();
				// #endif
			    //如果id为0或1或2的时候跳首页的处理
			    if(id==0||id==1||id==2){
			      if (id == '1') {
			      }
			      this.mapCtx.getCenterLocation({
			        success: (res) => {
			          console.log('跳首页的我是res的值a');
			          console.log(res);
			          if (res.latitude == 0 && res.longitude == 0) return; 
					  // res.longitude=113.00736;
					  // res.latitude=28.22749;
						this.getNearbyWorker(res.longitude, res.latitude, type);
			        }
			      })
			    }
			  },

			// 点击全选的操作
			handleRefreshTap: function() {
				this.showWorkerBox = "hide";
				// 工种相关字段
				this.workerName = "";
				//籍贯相关字段
				this.birthPlaceName = "";
				//地图标注字段
				this.markers = [];
				//搜索工人列表参数
				this.work_category_id = "";
				this.native_district_id = "";
				this.district_id = ""; 
				//工人详情
				this.workerDetail = {};
				this.distance = "0";
				var that=this;
				this.mapCtx.getCenterLocation({
					success: (res) => {
						if (res.latitude == 0 && res.longitude == 0) {
							return;
						}
						// 设置标记点
						let markers = {
							id: 999999,
							name: "选择位置",
							iconPath: "../../static/loc.png",
							latitude: res.latitude,
							longitude: res.longitude,
							width: that.icon_width,
							height: that.icon_height,
							zIndex: 10,
						};
						let markersData = that.markers;
						markersData.unshift(markers);
						that.markers= markersData;
						that.getNearbyWorker(res.longitude, res.latitude, 3);
					}
				})
	},

	// 工种筛选
	onWorkerType: function() {
			uni.navigateTo({
				url: '../vip-info/worker-type/worker-type?cat=indexBirth',
			})
		},
		// 工人籍贯筛选
		onBirthPlaceType: function() {
			console.log('筛选籍贯的开始');
			uni.navigateTo({
				url: '../city-choose/city-choose?pageType=indexBirth',
			})
			console.log('筛选籍贯的结束');
		},
		// 筛选
		workerFilter: function(cat, id) {
			let {
				work_category_id,
				native_district_id
			} = this;
			var category_id = 0,
				native_id = 0; // 工种,籍贯
			// 工种筛选
			if (work_category_id && !native_district_id) {
				category_id = work_category_id;
			}
			// 籍贯筛选
			if (native_district_id && !work_category_id) {
				native_id = native_district_id;
			}
			// 工种籍贯一起筛选
			if (work_category_id && native_district_id) {
				category_id = work_category_id;
				native_id = native_district_id;
			}
			this.getNearbyWorker(this.longitude, this.latitude, 3, native_id, category_id);
		},

		/*根据经纬度筛选附件的工人信息*/
		getNearbyWorker: function(longitude, latitude, type, native_district_id, category_id) {
			// let token = uni.getStorageSync('token');
			//始终用全局的token
			let token = app.globalData.token;
			let mobile = app.globalData.mobile;
			this.longitude = longitude;
			this.latitude = latitude;
			type = type == undefined ? '0' : type;
			native_district_id = native_district_id == undefined ? '0' : native_district_id;
			category_id = category_id == undefined ? '0' : category_id;
			//优先用户手机号码
			if (mobile) {
				gyzjModel.prototype.getNearbyWorker(longitude, latitude, token, type, native_district_id, category_id, mobile).then(
					res => {
						console.log('获取附近值成功1a');
						let arr = res.data.data;
						console.log('最终附近值arr的值',arr);
						//删除399个，返回这399个元素
						arr = arr.splice(1, arr.length - 1);
						this.workerData = arr;
						this.showWorker(arr);
					});
			} else if (token) {
				console.log('获取附近值成功22');
				gyzjModel.prototype.getNearbyWorker(longitude, latitude, token, type, native_district_id, category_id).then(res => {
					let arr = res.data.data;
					//删除399个，返回这399个元素
					arr = arr.splice(1, arr.length - 1);
					this.workerData = arr;
					this.showWorker(arr);
				});
			} else {
				console.log('加载附近工人失败!');
			}
		},
		//重新渲染工人marker
		showWorker: function(data) {
			// this.getSelfPosition();
			let mkList = [];
			for (var i = 0; i < data.length; i++) {
				let marker = {
					id: data[i].id,
					name: data[i].name,
					iconPath: gyzjModel.prototype.getWorkerTypeImg(data[i].workCategory.id),
					latitude: parseFloat(data[i].latitude),
					longitude: parseFloat(data[i].longitude),
					width: this.icon_width,
					height: this.icon_height,
				};
				mkList.push(marker);
			}
			let markers = this.markers;
			console.log('执行渲染开始的markers',markers);
			console.log('markers[0]的值',markers[0]);
			mkList.unshift(markers[0]);
			this.markers = mkList;
			console.log('追加后的markers',markers); 
		},
		//判断是否存在token
		isToken: function(longitude, latitude, type, native_district_id, category_id, mobile) {
			console.log('isToken进来a执行了token', app.globalData.token);
			console.log('isToken进来mobile的值', mobile);
			console.log('isToken进来是否有token的值',token);
			console.log('longitude',longitude);
			console.log('latitude',latitude);
			console.log('type',type);
			console.log('native_district_id',native_district_id);
			console.log('category_id',category_id);
			console.log('mobile',mobile);
			if (mobile) {
				this.getNearbyWorker(longitude, latitude, type, native_district_id, category_id, mobile);
			} else {
				var token = app.globalData.token;
				if (token) {
					console.log('执行了token1a');
					this.getNearbyWorker(longitude, latitude, type, native_district_id, category_id);
				} else {
					console.log('执行了token2');
					var timer = setInterval(res => {
						if (token) {
							clearTimeout(timer);
							this.getNearbyWorker(longitude, latitude, type, native_district_id, category_id);
						}
					}, 1000)
				}
			}
		},
		// 根据经纬度拿城市
		loadCity: function(longitude, latitude) {
			gyzjModel.prototype.getLongitudeCity(longitude, latitude).then(res => {
				console.log('百度api位置', res);
			});
		},
		//获取工人列表
		getWorkerList: function(work_category_id, native_district_id, district_id) {
			this.showWorkBox = 'show';
			uni.showLoading({
				title: '工人列表加载中'
			})
			gyzjModel.prototype.getWorkerList(work_category_id, native_district_id, district_id).then(data => {
				switch (data.code) {
					case 1:
						data = data.data.data;
						var mkList = [];
						for (var i = 0; i < data.length; i++) {
							var marker = {
								id: data[i].id,
								name: data[i].name,
								iconPath: gyzjModel.prototype.getWorkerTypeImg(data[i].workCategory.id),
								latitude: parseFloat(data[i].latitude),
								longitude: parseFloat(data[i].longitude),
								width: this.icon_width,
								height: this.icon_height,
							};
							mkList.push(marker);
						};
						this.markers = mkList;
						uni.hideLoading();
						break;
					default:
						uni.hideLoading();
						uni.showToast({
							title: data.message,
							icon: 'none'
						});
						break;
				}
			});
		},
		/*获取工人详情*/
		getWorkerDetail: function(id) {
			console.log('这个人进来aaa');
			uni.showLoading({
				title: '数据详情加载中...',
			});
			gyzjModel.prototype.getWorkerDetail(id).then(data => {
				switch (data.code) {
					case 1:
						console.log('进来成功返回详情啊');
						data = data.data;
						this.workerDetail = data;
						//获取星级评分
						var starArray = gyzjModel.prototype.convertToStarsArray(data.score_level);
						this.starArray = starArray;
						//获取坐标距离
						console.log(typeof(this.currLocation.longitude));
						console.log(typeof(this.currLocation.latitude));
						console.log(typeof(data.longitude));
						console.log(typeof(data.latitude));
						this.getDistance(this.currLocation.longitude, this.currLocation.latitude, data.longitude, data
							.latitude);
						uni.hideLoading();
						break;
					default:
						uni.hideLoading();
						uni.showToast({
							title: data.message,
							icon: 'none'
						});
						uni.hideToast();
						break;
				}
			}).catch((error) => {
				uni.hideLoading();
				gyzjModel.prototype.errorMessage(error);
			});
		},
		/*获取两坐标之间的距离*/
		getDistance: function(lng1, lat1, lng2, lat2) {
			console.log('进来成功距离');
			uni.showLoading({
				title: '坐标距离加载中...',
			});
			gyzjModel.prototype.getDistance(lng1, lat1, lng2, lat2).then(data => {
				switch (data.code) {
					case 1:
						console.log('进来成功返回距离');
						this.distance = data.data;
						console.log('this.distance', this.distance);
						uni.hideLoading();
						break;
					default:
						console.log('进来没有返回距离');
						uni.hideLoading();
						uni.showToast({
							title: data.message,
							icon: 'none'
						});
						uni.hideToast();
						break;
				}
			}).catch((error) => {
				console.log('距离报错了');
				uni.hideLoading();
				gyzjModel.prototype.errorMessage(error);
			});
		},
		//点击标记点时触发
		markertap: function(e) {
			console.log('執行了點擊事件');
			console.log('点击了数据详情啊', e);
			//如果点击的是标记指针，则退出
			if (e.markerId == 66) {
				return;
			}
			this.workerDetail = {};
			// #ifdef MP-WEIXIN
			this.showWorkerBox = 'show';
			// #endif
			console.log('这个人啊a', e.markerId);
			/*點擊詳情*/
			this.getWorkerDetail(e.markerId);
			//詳情，通過組件的形式來
			
			// const subNav=uni.getCurrentSubNVue();
			// #ifdef APP-PLUS
			uni.$emit('index-page-popup',{id:e.markerId,currLocation:this.currLocation})
			const subNVue = uni.getSubNVueById('layer');
			subNVue.show('slide-in-top', 200);
			// #endif
			
		},
		// 地图地区移动
		onRegionChange: function(e) {
			if (e.type === 'end') {
				this.mapCtx.getCenterLocation({
					success: (res) => { 
				//10月13获取
				// uni.getLocation({
				// 	type: 'gcj02', 
				// 	// wgs84
				// 	success: (res) => {
						console.log('res的gcj02的值',res);
						//如果暂未获取到定位，则取消工人信息获取
						if (res.latitude == 0 && res.longitude == 0) return;
						console.log('onRegion参数', res);
						let regionChangelongitude = res.longitude;
						let regionChangelatitude = res.latitude;
						console.log('将要改变的值经度', regionChangelongitude);
						console.log('将要改变的值纬度', regionChangelatitude);
						var that = this;
						this.mapCtx.translateMarker({
							markerId: 66,
							destination: {
								longitude: res.longitude,
								latitude: res.latitude,
							},
							duration: 500,
							success: function() {
								console.log('成功方法');
								console.log('that.work_category_id',that.work_category_id);
								console.log('that.native_district_id',that.native_district_id);
								var type, work_category_id, native_district_id,currentTab;
								if (that.currentTab == 0) {
									work_category_id = that.work_category_id ? that.work_category_id : '0';
									native_district_id = that.native_district_id ? that.native_district_id : '0';
								}
								currentTab=that.currentTab;
								console.log('currentTab的值',currentTab);
								// currentTab==0?type=3:currentTab==1?type=4:currentTab==2:type=5:'';
								if(currentTab==0){
									type = 3
								}else if(currentTab==1){
									type=4;
								}else if(currentTab==2){
									type=5;
								}else{
									type='';
								}
							
								console.log('success执行的值', regionChangelatitude);
								console.log('type的值', type);
								console.log('native_district_id的值', native_district_id);
								console.log('work_category_id的值', work_category_id);
								let arr = that.main_getGlobal();

								if (arr.type == 2) {
									console.log('执行了2的操作');
									that.markers = '';
									that.isToken(regionChangelongitude, regionChangelatitude, type, native_district_id, work_category_id,
										arr.token);
								} else {
									console.log('执行了1的操作');
									that.isToken(regionChangelongitude, regionChangelatitude, type, native_district_id, work_category_id);
								}
							},
							animationEnd: function() {
								console.log('aa执行了animationEnd方法');
							},
							fail: function(e) {
								console.log('执行了fail方法', e);
							}
						})
					}
				})
			}
		},
		/*点击查看工人详情*/
		workerDetailTap(e) {
			let status = e.currentTarget.dataset.status;
			if (status == 2) {
				uni.navigateTo({
					url: '../worker-spacing/worker-spacing',
				})
			} else {
				uni.navigateTo({
					url: '../user-center/my-info/cardcase/cardcase?id=' + e.currentTarget.id,
				})
			}
		}

	},
	/*页面卸载*/
	onUnload(){
		// #ifdef APP-PLUS
		uni.$off('layer');
		uni.$off('index-page-popup')
		// #endif
	},
	}
</script>

<style>
	/*给范围指定的人发送短信*/
	.center_bar,
	.center_bar image {
		width: 40upx;
		height: 40upx;
		z-index: 999;
	}
	
	/* 我的位置 */
	#map {
		position: relative;
		width: 100%;
		height: 100%;
	}

	.map {
		/* height: 884upx; */
		/* height: 100%; */
	}

	.mapH {
		height: 893upx;
	}

	.my-loc-wrap {
		position: absolute;
		bottom: 40upx;
		right: 20upx;
		background-color: #fff;
		border-radius: 50%;
		box-shadow: 0 0 10px 1px #ccc;
	}

	.my-loc {
		width: 60upx;
		height: 60upx;
		padding: 10px;
	}

	/* 分类筛选 */
	.fixed-top-container {
		width: 100%;
		background-color: #fff;
		height: 9vh;
		font-size: 14px;
	}

	.fixed-top {
		display: flex;
		justify-content: space-between;
		box-sizing: border-box;
		height: 100%;
		align-items: center;
		/* border: 1px solid #e5e5e5; */
	}

	.fixed-top-left {
		display: flex;
		margin-left: 20upx;
	}

	.fixed-item {
		padding: 0upx 20upx;
		height: 68upx;
	}

	.fixed-item image {
		width: 56upx;
	}

	.fixed-cat,
	.fixed-birthPlace {
		border: 1px solid #666;
		/* color: #F94C48; */
		border-radius: 5px;
		margin-right: 20upx;
	}
	.is135 {
		bottom: 135upx;
	}

	.worker-detail-box {
		display: flex;
		align-items: center;
		background-color: #fff;
		padding: 20upx 30upx;
	}

	.photo {
		width: 88upx;
		height: 88upx;
		display: block;
	}

	.info-box {
		width: 350upx;
		overflow: hidden;
		/* margin-right: 20upx; */
	}

	.max-width-190 {
		max-width: 190upx;
	}

	.worker-type {
		/* max-width: 130upx; */
		margin: 0 20upx;
		color: #c90000;
		font: 34upx/34upx '微软雅黑';
	}

	.right-box {
		width: 200upx;
		height: 60upx;
		flex: 1;
		border-radius: 5px;
		text-align: center;
		padding: 2upx 15upx;
		border: 1px solid #f94c48;
		background-color: #f94c48;
		color: #fff;
		display: flex;
		align-items: center;
		justify-content: center;
		position:relative;
	}

	.right-box-check {
		display: inline-block;
		margin-left:150upx;
		position:absolute;left:50upx;top:50upx;
	}

	.right-box-check-img {
		display: inline-block;
		width: 25upx;
		height: 20upx;
		/* margin-left: 10upx; */
	}

	.star-box {
		display: flex;
		margin-top: 2px;
	}

	.star-item {
		width: 30upx;
		height: 30upx;
		margin-right: 4upx;
	}

	.txt-gray {
		color: #999;
		font-size: 30upx;
	}

	/* 刷新图标和联系客服图标 */
	.refresh-wrap {
		width: 100upx;
		height: 68upx;
		box-sizing: border-box;
	}

	.refresh-icon {
		width: 100%;
		height: 100%;
	}

	.float-l {
		float: left;
	}

	.over-hidden {
		overflow: hidden;
		height: 50upx;
		line-height: 50upx;
	}

	/* 弹出框 */
	.index-pop-up {
		width: 100%;
		height: 100%;
		position: fixed;
		z-index: 99;
	}

	.index-pop-back {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		background-color: #000;
		opacity: .5;
		z-index: -1;
	}

	.index-pop-view {
		position: relative;
		width: 100%;
		height: 100%;
		display: flex;
		align-items: center;
		justify-content: center;
		z-index: 99;
	}

	.index-pop-btn {
		width: 70%;
		height: 60%;
		border-radius: 20upx;
	}

	.index-pop-img {
		width: 100%;
		height: 100%;
		border-radius: 40upx;
	}

	.index-pop-colse {
		width: 60upx;
		height: 60upx;
		position: absolute;
		top: 20%;
		right: 15%;
		transform: translate(40%, -40%);
		z-index: 99;
	}

	.fixed-top-cont {
		width: 100%;
		background-color: #ebefed;
		display: flex;
		flex-direction: column;
		/* max-height: 20vh;
	  min-height: 12vh; */
		overflow: hidden;
	}

	.cont-block {
		display: flex;
		height: 10vh;
		border-bottom: 1px solid #e5e5e5;
	}

	.cont-list {
		width: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
		border-right: 1px solid #e5e5e5;
		font-size: 36upx;
		background-color: #ffffcc;
	}

	.cont-list:nth-child(3) {
		border-right: none;
	}

	.cont-list image {
		width: 20upx;
		height: 15upx;
		margin-left: 10upx
	}

	.cont-list text:nth-child(1) {
		display: block;
		width: 153upx;
		height: 30upx;
		margin-bottom: 10upx;
	}

	/*如果是最后一个样式存在冲突*/
	/* .cont-list:nth-child(4) text:nth-child(1){
	  line-height:100upx;
	} */
	.cont-list .newstabBar {
		text-align: center;
		height: 90upx;
		/* margin-top:-10upx; */
	}

	/* .cont-list:nth-child(1) .newstabBar{
	  border-bottom: 8upx solid white;
	} */
	.cont-list text:nth-child(2) {
		display: block;
		width: 153upx;
		height: 30upx;
	}

	.listActive {
		background-color: #f94c48;
		color: #fff;
	}

	.listActiveWhite {
		border-bottom: 5upx solid white;
	}

	/* .listActiveBlack{
	  border-bottom: 8upx solid black;
	} */
	.info-box-name {
		max-width: 100upx;
		font-size: 32upx;
	}

	.map-banner {
		width: 100%;
		height: 135upx;
		position: fixed;
		bottom: 0;
		left: 0;
	}

	.map-banner-img {
		width: 100%;
		height: 100%;
	}

	/*追加的工人详情样式*/
	cover-view {
		display: block;
		line-height: 1.2;
		overflow: hidden;
		white-space: nowrap;
		pointer-events: auto;
		font-family: -apple-system;
	}

	.worker-type {
		margin: 0 20upx;
		color: #c90000;
	}

	.dp-flex-y-center {
		display: flex;
		align-items: center;
	}
	.photo-box {
		width: 88upx;
		margin-right: 20upx;
	}
	.hide {
		display: none;
	}
	.show {
		display: block;
	}
	/*底部的排列*/
	.fixed-bottom-cont{
		display:flex;
		width:100%;
		/* position:fixed;
		bottom:0upx;
		left:0upx; */
		position:absolute;
		top:100upx;
		background-color:blue;
		height:auto;
		margin-top:100upx;
	}
	/* #ifdef MP-WEIXIN */
	.fixed-bottom-content {
		border-top: 1px solid #e5e5e5;
		position: fixed;
		bottom: 0;
		left: 0;
		width: 750upx;
		z-index: 999;
	}
	/* #endif */
	
</style>
